<?php
namespace application\admin\panels;
abstract class panel {
	public $name;
	protected $messages = array(
		'success'=>array(),
		'error'=>array(),
		'alert'=>array()
	);
	public function handleData() {}
	
	public function display() {}
	
	public static function header() {}	
	public function sidebar() {}
	
	public function title() {
		return 'Title';
	}
	protected function addMessage($type, $message) {
		switch($type) {
			case 'error':
				$this->messages['error'][] = $message;
				break;
			case 'alert':
				$this->messages['alert'][] = $message;
				break;
			case 'success':
				$this->messages['success'][] = $message;
				break;
		}
	}
	
	public function mergeMessages($messages) {
		if(is_array($messages['errors'])) {
			$this->messages['error'] = array_merge($this->messages['error'], $messages['errors']);
		}
		if(is_array($messages['successes'])) {
			$this->messages['success'] = array_merge($this->messages['success'], $messages['successes']);
		}
		if(is_array($messages['alerts'])) {
			$this->messages['alert'] = array_merge($this->messages['alert'], $messages['alerts']);
		}
	}
	
}

?>